<template>
	<nav-header :title="title">
		<u-sticky v-if="codeType == 'qiye' || codeType == 'chanye'" :offsetTop="system.statusBarHeight + 44">
			<view class="bg-white">
				<view style="width: 210px;margin: auto;">
					<u-tabs :current="current" :list="tabList" :activeStyle="{color: '#2d58cb',transform: 'scale(1.05)'}"
						:inactiveStyle="{ color: '#666666',transform: 'scale(1)'}"
						itemStyle="width: 70px;height: 44px;align: center;padding-left: 0px; padding-right: 0px;"
						lineColor="#2d58cb" @change="({index})=>{current=index;type=index === 0? 'company':(type=index === 1? 'product':'project')}"></u-tabs>
				</view>
			</view>
		</u-sticky>

		<company ref="company" v-if="current == 0" :codeType="codeType" :dictType="dictType"></company>
		<product ref="product" v-if="current == 1" :companyId="companyId" :codeType="codeType"></product>
		<project ref="project" v-if="current == 2" :companyId="companyId" :codeType="codeType"></project>
	</nav-header>
</template>

<script>
	import {mapState} from 'vuex'
	import NavHeader from '@/components/nav_header.vue'
	import Company from '@/pages_home/lianmeng/company.vue'
	import Product from '@/pages_home/lianmeng/product.vue'
	import Project from '@/pages_home/lianmeng/project.vue'
	import MescrollLevel2Mixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-level2.js"
	export default {
		mixins: [MescrollLevel2Mixin],
		components: {
			NavHeader,Company,Product,Project
		},
		data() {
			return {
				current: -1,
				companyId: '',
				tabList: [
					{name: '企业'},
					{name: '设备'},
					{name: '平台'},
				],
        type: 'company',
        codeType: '',
        title: '供需对接',

			}
		},

		onLoad(e) {
			this.current = e.current? e.current:0
      if (e.codeType) {
        this.codeType = e.codeType
        this.title = e.codeType == 'qiye'? '企业服务':
            (e.codeType == 'chanye'? '产业服务':
                (e.codeType == 'shenghuo'? '生活服务':
                    (e.codeType == 'jinrong'? '金融服务':'供需对接')))
      }

			if (e.companyId) this.companyId = e.companyId
		},
		computed: {
			...mapState({
				system: state => state.system
			})
		},

		// onPullDownRefresh () {
		// 	uni.stopPullDownRefresh()
		// },
		methods: {

		},
    reloadData() {
      this.$refs['mypage'].dataReload()
    }
	}
</script>

<style>
	page{
		background-color: #f7f7f7;
	}
</style>
